/*
 * Copyright (c) 2023 Huawei Technologies Co., Ltd.
 * openUBMC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *         http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

#ifndef PLDM_EMULEX_H
#define PLDM_EMULEX_H

#include <stdint.h>

#define FW_VERSION_TLV_TYPE 0x02
#define PART_NUMBER_TLV_TYPE 0x03
#define SERIAL_NUMBER_TLV_TYPE 0x04
#define WWNN_TLV_TYPE 0x83
#define WWPN_TLV_TYPE 0x84

#define MAX_FRU_TABLE_RECORD_NUM 6
#define FRU_RECORD_ID_GENERAL 1
#define FRU_RECORD_ID_CHIP 3
#define FRU_RECORD_ID_PORT0 4
#define FRU_RECORD_ID_PORT1 5

#define MCTP_PLDM_GET_RECORD_TABLE_FIRST_PART 0x01
#define MCTP_PLDM_GET_RECORD_TABLE_NEXT_PART 0x00
#define FRU_TABLE_TRANSFER_FLAG_END 0x04
#define FRU_TABLE_TRANSFER_FLAG_START_END 0x05

#pragma pack(1)
typedef struct pldm_get_fru_record_table_rsp {
    uint32_t next_data_transfer_handle;
    uint8_t transfer_flag;
    uint16_t record_id;
    uint8_t record_type;
    uint8_t number_field;
    uint8_t encoding_type;
    uint8_t data[1];
} pldm_get_fru_record_table_rsp_t;

typedef struct pldm_get_fru_record_table_req {
    uint32_t data_transfer_handle;
    uint8_t transfer_operation_flag;
} pldm_get_fru_record_table_req_t;

#pragma pack()

#endif  